import type { PatientItem, PatientParams } from '@/types/patient'
import { request } from '@/utils/http'
import type { OrderParams } from '@/types/consult'
/**
 * 添加患者（家庭档案）
 */
export const addPatientApi = (data: PatientParams) => {
  return request.post('/patient/add', data)
}
export const patientListApi = () => {
  return request.get<null, PatientItem[]>('/patient/mylist')
}
/**
 * 问诊-删除患者信息
 * @param id 患者id
 * @returns
 */
export const removePatientApi = (id: string) => {
  return request.delete(`/patient/del/${id}`)
}

/*
问诊-患者详情
@params id 患者id
@returns
*/
export const patientDetailApi = (id: string) => {
  return request.get<null, PatientItem>(`/patient/info/${id}`)
}
/**
 * 问诊-编辑患者信息
 * @param data
 * @returns
 */
export const updatePatientApi = (data: PatientParams) => {
  return request.put(`/patient/update`, data)
}
/**
 * 问诊-保存/修改问诊订单(创建订单 -> 返回订单id -> 支付)
 */
export const createOrderApi = (data: OrderParams) => {
  return request.post<null, { id: string }>('/patient/consult/order', data)
}
